@layout('layouts/page')

@section('content')

<!-- <div id="iconPanel"  class="twelve">
	<a id="loginKey" href="{{url('help')}}">{{HTML::image('img/icons/user.png', 'testing')}}<br/>Setup Role</a>
	<a id="loginKey" href="{{url('help')}}">{{HTML::image('img/icons/access.png', 'testing')}}<br/>Setup ACL</a>
</div> -->
<div id="menuTree" class="twelve columns panel form">
<!-- <pre>{{var_dump($acl)}} -->
{{ Form::open('admin/acl', 'POST') }}
	<ul class="disc accordion">
		@foreach ($rolelist as $role)
		<li class="{{ in_array($role->roleid,array_keys($acl))? 'active':''}}">
			<div class="title" >
				{{Str::upper($role->role)}}
			</div>
			<div class="content">
				@foreach ($page as $selection)
					{{Form::hidden($role->role.'[id]',$role->roleid);}}
					<label class="checkbox" for="{{$role->role}}[{{$selection->action}}]">
						@if(in_array($role->roleid,array_keys($acl)) && in_array($selection->controller,array_keys($acl[$role->roleid])) &&  in_array($selection->action,array_keys($acl[$role->roleid][$selection->controller])) && $acl[$role->roleid][$selection->controller][$selection->action] == true)
						<input type="checkbox" checked="true" name="{{$role->role}}[{{$selection->controller}}][{{$selection->action}}]" id="{{$role->role}}[{{$selection->controller}}][{{$selection->action}}]" >
	                 	@else
						<input type="checkbox" name="{{$role->role}}[{{$selection->controller}}][{{$selection->action}}]" id="{{$role->role}}[{{$selection->controller}}][{{$selection->action}}]" >		            
	                 	@endif
	                 	{{$selection->actionalias}}
	                </label>
				@endforeach
			</div>
		</li>
		@endforeach
	</ul>
	{{ Form::submit('SIMPAN')}}
{{ Form::close()}}
</div>

@endsection